import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    firewallList = '/firewall/getByType',
    firewallCreate = '/firewall/create',
    firewallDelete = '/firewall/delete',
    firewallUpdate = '/firewall/update',
    firewallInTemp = '/firewall/intemp',
    updateInBoundTemp = '/firewall/in/updatetemp',
    updateOutBoundTemp = '/firewall/out/updatetemp',
}

/**
 * @description: 修改
 */
export function firewallUpdate(params: any) {
    return http.request({
        url: Api.firewallUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function firewallDelete(params: any, option: any) {
    return http.request({
        url: Api.firewallDelete,
        method: 'POST',
        params,
    },{
        ...option,
        isTransformRequestResult: false,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function firewallCreate(params: any) {
    return http.request({
        url: Api.firewallCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function firewallList(params: any) {
    return http.request({
        url: Api.firewallList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}

export function inboundInTemp(tempid: number){
    return http.request({
        url: Api.firewallInTemp,
        method: 'POST',
        params:{"tempid":tempid,"type":0},
    })
}

export function outboundInTemp(tempid: number){
    return http.request({
        url: Api.firewallInTemp,
        method: 'POST',
        params:{"tempid":tempid,"type":1},
    })
}

export function updateInBoundTemp(params: any){
    return http.request({
        url: Api.updateInBoundTemp,
        method: "POST",
        params,
    })
}

export function updateOutBoundTemp(params: any){
    return http.request({
        url: Api.updateOutBoundTemp,
        method: "POST",
        params,
    })
}
